package com.silence.gmall.item.rpc;

import com.silence.gmall.annotations.Log;
import com.silence.gmall.base.Result;
import com.silence.gmall.item.service.SkuDetailService;
import com.silence.gmall.web.vo.res.SkuDetailResVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author silence
 * @Description 一级分类表控制器
 * @Date 2025-08-17 16:28:16
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/inner/item")
public class ItemRpcController {

    /**
     * SkuDetailService 注入
     */
    private final SkuDetailService skuDetailService;

    /**
     * 获取SKU详情
     *
     * @param skuId skuID
     * @return sku 信息
     */
    @GetMapping("/getSkuDetail/{skuId}")
    @Log(interfaceName = "获取SKU详情")
    public Result<SkuDetailResVo> getSkuDetail(@PathVariable("skuId") Long skuId) {
        return Result.build(skuDetailService.getSkuDetailByAnnotation(skuId));
    }

}